<?php
/**
 *
 * User: Jessica@aweb.wang
 * Date: 2023/3/10 14:50
 * Email: <1194323013@qq.com>
 *                            _ooOoo_
 *                           o8888888o
 *                           88" . "88
 *                           (| -_- |)
 *                           O\  =  /O
 *                        ____/`---'\____
 *                      .'  \\|     |//  `.
 *                     /  \\|||  :  |||//  \
 *                    /  _||||| -:- |||||-  \
 *                    |   | \\\  -  /// |   |
 *                    | \_|  ''\---/''  |   |
 *                    \  .-\__  `-`  ___/-. /
 *                  ___`. .'  /--.--\  `. . __
 *               ."" '<  `.___\_<|>_/___.'  >'"".
 *              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
 *              \  \ `-.   \_ __\ /__ _/   .-` /  /
 *         ======`-.____`-.___\_____/___.-`____.-'======
 *                            `=---='
 *        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 *                      Buddha Bless, No Bug !
 **/

namespace app\common\exception;
use app\common\utils\ResponseUtils;
use think\Exception;

class BusinessException extends Exception
{
    /**
     * 异常数据信息
     * @var object|string
     */
    private $errData;

    /**
     * BusinessException constructor.
     * @param array  $businessStatus 异常状态及提示
     * @param object $data 异常数据信息
     */
    public function __construct($businessStatus) {
        $this->errData =$businessStatus[1];
        parent::__construct($businessStatus[1], $businessStatus[0]);
    }

    /**
     * 获取异常数据
     * @return object|string
     */
    public function getError() {
        return ResponseUtils::retError($this->errData);
    }
}